import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(urlPatterns = {"/login/dgout"})
public class LogoutServlet extends HttpServlet{
    protected void doPost(HttpServletRequest req,
                         HttpServletResponse resp) throws IOException {
       if((req.getSession().getAttribute("userDTO"))!=null){
           req.getSession().removeAttribute("userDTO");
           resp.sendRedirect("https://cas.dgut.edu.cn/logout?callback=http://localhost:8080/index.jsp");
        }
    }
}
